import java.util.HashSet;
import java.util.Set;

/**
 * @auther wangchenghao
 * @date 2021/5/5
 **/
public class solution_1 {
    public int findRepeatNumber(int[] nums) {
        Set<Integer> dir = new HashSet<>();
        for (int num : nums) {
            if (dir.contains(num)) return num;
            dir.add(num);
        }
        return -1;
    }
}
